import request from '@/utils/request';

/**
 * 充值列表
 * @param params 查询条件
 */

export async function topUpList(params) {
  const res = await request.get('/massage/topUpList/page', {
    params
  });

  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// 提现列表头部数据
export async function getTopUpListHead(params) {
  const res = await request.get('/massage/topUpList/getTopUpListHead', {
    params
  });

  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// 充值列表新增接口
export async function topUpListInsert(data) {
  const res = await request.post('/massage/topUpList', data);
  if (res.data.code === 200) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}
// 充值列表修改接口
export async function topUpListModify(data) {
  const res = await request.put('/massage/topUpList', data);
  if (res.data.code === 200) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}
/**
 *  删除
 * @param params 查询条件
 */

export async function topUpListDelete(id) {
  const res = await request.delete('/massage/topUpList/' + id);
  console.log(res);
  if (res.data.code === 200) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}
/**
 *  批量删除
 * @param params 查询条件
 */
export async function topUpListDeleteBatch(data) {
  const res = await request.delete('/massage/topUpList/batch', {
    data
  });
  console.log(res);
  if (res.data.code === 200) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}
